package cn.zero.letaomallspringboot.common;

import cn.zero.letaomallspringboot.entity.Order;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {
    private List<T> data;
    /**
     * 当前页码
     */
    private Integer page;
    /**
     * 每页条数
     */
    private Integer size;
    /**
     * 总记录数
     */
    private Long total;


    //共分类使用
    public PageResult(Integer page, Integer size, Long total, List<T> data) {
        this.page = page;
        this.size = size;
        this.total = total;
        this.data = data;
    }

    //共商品使用
    public PageResult(List<T> data, long total) {
        this.data = data;
        this.total = total;
    }

    //共商品规格用
    public PageResult(long total, List<T> data) {
        this.data = data;
        this.total = total;
    }

    public PageResult(Long total, int page, int size, List<T> data) {
        this.total = total;
        this.page = page;
        this.size = size;
        this.data = data;
    }
}